{layout name="../common/master"/}

<script src="__PUBLIC__/uploadify/jquery.uploadify.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/uploadify/uploadify.css">

<div id="right">
    <h4 style="border-bottom: 1px solid #ccc;padding-bottom: 3px">添加优惠券</h4>
    <div id="app">
        <form action="javascript:;" method="post" role="form" class="col-lg-6">
            <div class="form-group">
                <label for="">优惠券名称</label>
                <input type="text" class="form-control" required  name="name"  placeholder="请输入优惠券名称">
            </div>
            <div class="form-group">
                <label for="">优惠券编号</label>
                <input type="text" class="form-control" required  name="admin_num"  placeholder="请输入优惠券编号">
            </div>
            <div class="form-group">
                <label for="">优惠券类型</label>
                <select name="type" id="couponType" class="form-control">
                    <option value=""> -- Select One --</option>
                    <option value="1"> 折价券</option>
                    <option value="2">免息券</option>
                </select>
            </div>
            <div class="form-group">
                <label for="">金额</label>
                <input type="text" class="form-control" id="couponBonus" name="bonus"  placeholder="请输入金额">
            </div>
            <div class="form-group">
                <label for="">适用产品类型</label>
                <select name="attachedProductType" id="attachedProductType" class="form-control">
                    <option value=""> -- Select One --</option>
                    <option value="1"> 0307</option>
                    <option value="2"> 0314</option>
                    <option value="3"> 0607</option>
                    <option value="4"> 0614</option>
                    <option value="5"> 1007</option>
                    <option value="6"> 1015</option>
                    <option value="100"> EWI</option>
                </select>
            </div>
            <div class="form-group">
                <label for="">金额下限</label>
                <input type="text" class="form-control"  name="downAmount"  placeholder="请输入金额上限">
            </div>
            <div class="form-group">
                <label for="">金额上限</label>
                <input type="text" class="form-control"  name="upperAmount"  placeholder="请输入金额下限">
            </div>
            <div class="form-group">
                <label for="">上行期限</label>
                <input type="text" class="form-control"  name="upperPeriod"  placeholder="请输入上行期限">
            </div>
            <div class="form-group">
                <label for="">下行期限</label>
                <input type="text" class="form-control"  name="downPeriod"  placeholder="请输入下行期限">
            </div>
            <div class="form-group">
                <label for="">适用开始时间</label>
                <input name="use_start_time" type="text" id="" onclick="WdatePicker({startDate:'2017-11-01',alwaysUseStartDate:true})"/>
            </div>
            <div class="form-group">
                <label for="">适用结束时间</label>
                <input name="use_end_time" type="text" id="" onclick="WdatePicker({startDate:'2017-11-01',alwaysUseStartDate:true})"/>
            </div>
            <div class="form-group">
                <label for="">状态</label>
                <div class="radio">
                    <label>
                        <input type="radio" name="status" value="1" checked="checked">
                        激活
                    </label>
                    <label>
                        <input type="radio" name="status" value="0">
                        不激活
                    </label>
                </div>
            </div>
            <div class="form-group">
                <label for="">使用的平台</label>
                <input type="text" class="form-control" name="platFormID"  placeholder="请输入使用的平台">
            </div>
            <button type="submit" id="form_submit" class="btn btn-primary">提交</button>
        </form>
    </div>
</div>
<script>
    $("#couponType").change(function(){
        var value=$(this).val();
         if(value == 2){
           $("#couponBonus").attr('readonly',true);
        }else{
             $("#couponBonus").attr('readonly',false);
         }
    })
    $("#form_submit").click(function () {
        var data=$('form').serialize();
        $.post("{:URL('home/Coupon/couponAdd')}",data,function(res){
           if(res.code == 0){
               layer.msg("添加成功");
               location.href="{:URL('home/Coupon/couponList')}";
           }else{
               layer.msg(res.data,function(){});
           }
        })
    })
</script>
<script type="text/javascript" src="__PUBLIC__/home/tuo/DatePicker/WdatePicker.js"></script>

